<template>
    <div>
      <span>回车</span>
      <input @keydown.enter="fn" type="text" />
      <br />
      <span>esc</span>
      <input @keydown.esc="escFn" type="text" />
    </div>
  </template>
  
  <script>
  export default {
    methods: {
      fn() {
        console.log("按下回车键触发");
      },
      escFn() {
        console.log("按下esc键触发");
      },
    },
  };
  </script>
  
  <style>
  </style>